import time

from selenium.webdriver.common.by import By
class LoanOperation:
    #贷款
    def wangdai(self,driver,username,password,money,day):
        driver.find_element(By.ID, 'username').send_keys(username)
        time.sleep(1)
        driver.find_element(By.ID, 'password').send_keys(password)
        time.sleep(1)

        driver.find_element(By.ID, 'login_btn').click()
        time.sleep(1)
        # 金融工具
        driver.find_element(By.XPATH, '//*[@id="leftbaraside"]/div[2]/nav/ul/li[3]/a').click()
        time.sleep(1)
        # 安全网贷
        driver.find_element(By.XPATH, '//*[@id="leftbaraside"]/div[2]/nav/ul/li[3]/ul/li[2]/a').click()
        time.sleep(1)
        # 输入金额
        driver.find_element(By.XPATH, '//*[@id="amount"]').send_keys(money)
        time.sleep(1)

        driver.find_element(By.XPATH, '//*[@id="term"]').send_keys(day)
        time.sleep(1)
        # 申请按钮
        driver.find_element(By.XPATH, '//*[@id="submit"]').click()
        time.sleep(1)

        driver.find_element(By.XPATH, '/html/body/div[2]/div[2]/div/div/div/div/div/div/div/div[4]/button[1]').click()
        time.sleep(1)